<?php

namespace app\model;

class TeacherGetPriceModel extends BaseModel
{
    protected  $table = 'teacher_get_price';


    /**
     * @param $page
     * @param $pageSize
     * @param array $condition
     * @param bool $is_count
     * @param string $order
     * @return false|int|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getPriceListPage($page,$pageSize,$condition=[],$is_count = false,$order='created_at desc'){
        $join=[
            ['admin','admin.id=t.admin_id','left'],
            ['user_info','user_info.ui_id=t.ui_id','left'],
        ];
        $this->alias('t')
            ->field('t.*,admin.admin_name,user_info.ui_username')
            ->join($join);
        if($condition){
            $this->where($condition);
        }
        if($order){
            $this->order($order);
        }
        if($is_count){
            return $this->count();
        }
        return $this->page($page,$pageSize)->select();
    }
}